package com.bm.controller;

import com.bm.server.Neo4jOperationServer;
import com.google.gson.Gson;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: sx
 * Date: 2022/4/27
 * Time: 19:16
 * Description: java
 */
@RestController
public class Neo4jOperationController {

    @Resource
    private Neo4jOperationServer neo4jOperationServer;

    @RequestMapping(value = "/addNode", method = RequestMethod.POST)
    @ResponseBody
    @CrossOrigin
    public String addNode(@RequestBody HashMap<String, String> res){

//        @RequestParam("id")String id,
//        @RequestParam("name")String name,
//        @RequestParam("details")String  details,
//        @RequestParam("label")String label,
//        @RequestParam("sort")String sort
        int id = Integer.parseInt(res.get("id"));
        String name = res.get("name");
        String details = res.get("details");
        String label = res.get("label");
        String sort = res.get("sort");

        String msg = neo4jOperationServer.addNode(id,name,details,label,sort);
        return msg;
    }
}
